package com.item.schedule.controller;

import com.item.entity.ScheduleJobLogEntity;
import com.item.result.ResultVo;
import com.item.schedule.service.ScheduleJobLogService;
import com.item.util.PageUtilsPlus;
import com.item.util.ResultVoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 定时任务日志
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2016年12月1日 下午10:39:52
 */
@RestController
@RequestMapping("/sys/scheduleLog")
public class ScheduleJobLogController {
    @Autowired
    private ScheduleJobLogService scheduleJobLogService;

    /**
     * 分页查询定时任务日志
     *
     * @param params 查询参数
     * @return R
     */
    @GetMapping("/list")
    //@RequiresPermissions("sys:schedule:log")
    public ResultVo list(@RequestParam Map<String, Object> params) {
        PageUtilsPlus page = scheduleJobLogService.queryPage(params);

        return ResultVoUtil.success(page);
    }

    /**
     * 根据主键查询详情
     *
     * @param logId logId
     * @return R
     */
    @GetMapping("/info/{logId}")
    public ResultVo info(@PathVariable("logId") Long logId) {
        ScheduleJobLogEntity log = scheduleJobLogService.getById(logId);

        return ResultVoUtil.success(log);
    }
}
